*---------------------------------------------------------------------------------------------------*
Clinoform-modelling algorithm
Author: Gavin Henry Graham
Date: 11/01/2014

This is a research code and it is hoped that it will be useful. However, the author does not accept 
any responsibility to anyone for the consequences of using the code.
*---------------------------------------------------------------------------------------------------*

Copyright Declaration

The copyright of the code "Clinoform-modelling algorithm" rests with the author and is made available 
under a Creative Commons Attribution Non-Commercial No Derivatives licence. Researchers are free 
to copy, distribute or transmit the code on the condition that they attribute it, that they do not 
use it for commercial purposes and that they do not alter, transform or build upon it. For any reuse 
or redistribution, researchers must make clear to others the licence terms of this work.

*---------------------------------------------------------------------------------------------------*

Code Description
The clinoform-modelling algorithm is described in detail in Chapter 2 (p. 46 of the thesis) and is 
used to generate clinoform surfaces and their heterogeneity surfaces, based on simple user inputs 
to define the model volume and the geometry and distribution of the surfaces. A description of the 
inputs and outputs from the algorithm can be found below.  


Inputs: 
	
	1. File path (including file name) for the Base Surface in zmap+ file format
	   e.g. C:\Users\Imperial\Desktop\f1.6dummyps1.7A.zmap+ (see example inputs)

	2. File path (including file name) for the Top Surface in zmap+ file format
	   e.g. C:\Users\Imperial\Desktop\f1.7dummyps1.7A.zmap+ (see example inputs)

	3. The value in degrees for the clinoform progradation angle relative to North, theta, see 
	   Table 2.1 (p. 54 of the thesis) for more details (the value must be between 0 and 360).
	   This can be determisitic or the user can enter the value in the file generated by the 
	   Stochastic Property Generation code

	4. The proportion of the clinoform surface that acts as a barrier to flow. This value must be a 
           percentage  between 0 and 100. More details on this method can be found in Section 3.7.3 
	   (p. 118 of the thesis) as well as Fig. 3.6 (p. 119 of the thesis).

	5. The user is prompted to choose which software package the surfaces will be used in. 1 is the 
	   choice for Petrel in which the input surfaces and those generated by the clinoform modelling algorithm have
	   a negative value for depths if they are in the subsurface. 2 is the choice for RMS in which the input surfaces
           and those generated by the clinoform modelling algorithm have a postive value for depths if they are in the 
	   subsurface
	
	6. The clinoform shape fucntion, P, See Section 2.3.3  (p. 59 of the thesis) and Table 2.1 (p. 54 
	   of the thesis) for more details (value must be greater than than 0). This can be determisitic 
	   or the user can enter the vaule in the file generated by the Stochastic Property Generation
	   code
	
	7. The proximal boundary entry position, Po, this is  the initial insertion point for clinoforms 
	   in the model, See Section 2.3.4 (p. 61 of the thesis) and Table 2.1 (p. 54 of the thesis) for 
           more details (values must be between 0 and 1 only). This can be determisitic 
	   or the user can enter the vaule in the file generated by the Stochastic Property Generation
	   code. For example if the user enters 0.5 the clinoform surfaces will enter the proximal boundary
	   at the midpoint of the proximal boundary

	8. File path (including file name) for the parameter file containing  values for  bw, bl, tw, tl, 
	   and S (see Table 2.1 (p. 54 of the thesis) for more details). This has been included as an 
           example file and must be a .txt file. The user can enter determisitic values for each parameter
           if known or otherwise could use the parameter file generated by the Stochastic Property Generation
	   code
	   e.g. C:\Users\Imperial\Desktop\PS1.7_100.txt (see example inputs)		
	
	9. Value on which to alter the clinoform surfaces. When gridding it may be appropriate
	   to create an extra layer at the top and base of the grid, in order to reduce
	   numerical errors in flow simulation. This value adjusts the bounding surfaces from which the clinoforms 
	   and heterogeneity surfaces are generated, the top surface will be raised by the user 
	   specified value, while the base will be lowered by the user specified value. This is 
 	   only important for the heterogeneity surfaces, as it will allow for grid properties to 
           be created in these extra layers (see Create Transmissibility Multiplier Grid Property 
           Readme for more details). The user should discard the clinoforms generated if the 
           alteration value is greater than 0.0, and instead use clinoforms generated with 
           no alteration e.g.the user enters 0.0.

       10. The file path where the surfaces are to be exported
	   e.g C:\Users\Imperial\Desktop\outputs\

       11. Specification of whether the surfaces require post-depositional modification. There are four 
           options: 
	   
	   The user enters 0. If the user enters 0, no modification of the surfaces (either clinoform or
	   heterogeneity surfaces) will take place and the code will proceed to do a final QC of the 
	   surfaces before export to the the user specified destination folder.

	   The user enters 1. If the user enters 1, this corresponds to modification of the clinoform 
	   surfaces through erosion from an overlying channel for example e.g. Fig. 2.2B (p. 53 of
	   the thesis). The code will proceed to modify the clinoforms and heterogeneity surfaces to respect 
           the geometry of the new top bounding surface, before a final QC of the surfaces and export to 
           the the user specified destination folder.
	   
	   The user enters 2. If the user enters 2, this corresponds to modification of the clinoform 
	   and heterogeneity surfaces through progradation over irregular sea-floor topography for 
	   example e.g. Fig. 2.2C (p. 53 of the thesis). The code will proceed to modify the clinoforms 
           and heterogeneity surfaces to respect the geometry of the new base bounding surface, 
	   before a final QC of the surfaces and export to the the user specified destination folder.

	   The user enters 3. If the user enters 3, this corresponds to both the situations described 
	   in events 1 and 2 simultaneously, e.g. Fig. 2.2B and Fig. 2.2C combined. The code will proceed 
	   to modify the clinoforms and heterogeneity surfaces to respect the geometry of the new top and 
	   base bounding surfaces, before a final QC of the surfaces and export to the the user specified 
           destination folder.

       12. The file path (including file name) for the modification surface(s). This must have the same 
           specification in terms on number of nodes etc as the original bounding surfces and must also be in 
           zmap+ file format	   
	   e.g. C:\Users\Imperial\Desktop\PS1.7_100.txt (see example inputs)
           
Outputs:

	1. Clinoform surfaces in zmap+ file format

	2. Heterogeneity surfaces in zmap+ file format
